<?php

class Jf_WebServer_Bootstrap {

    public static function init () {
        $argv = $_SERVER['argv'];
        $runmode = isset ($argv[1]) ? str_replace ('-', '', $argv[1]) : '';
        if ($runmode == 'start') {
            self::start ();
        }
    }

    public static function start () {
        /*
         * if ( Bootstrap::$pid && Thread\Generic::ifExistsByPid(Bootstrap::$pid) ) { Core\Daemon::log('[START] phpDaemon with pid-file \'' . Daemon::$config->pidfile->value . '\' is running already (PID ' . Bootstrap::$pid . ')'); exit(6); }
         */
        Core\Daemon::init ();
        $pid = Core\Daemon::spawnMaster ();
        file_put_contents (Core\Daemon::$config -> pidfile -> value, $pid);
    }

}

